<?php
class permission_view_model extends MY_model
{
    public $authorities = array();
    public $permission = array();

    public function add_authority($authority_name)
    {
        $this->permission[$authority_name] = array();
    }

    public function add_permission($authority,$permission)
    {
        $this->permission[$authority][] = $permission;
    }

    function can($authority,$permission)
    {
        return in_array($permission, $this->permission[$authority]);
    }
}

?>